package com.social.socialservice.dal;

import com.social.socialservice.idal.IGlobalDAL;
import com.social.socialservice.model.I18nInfo;
import com.social.socialservice.unit.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 国际化方法实现
 */

@Service
public class GlobalDAL {
    @Autowired
    IGlobalDAL iGlobalDAL;

    /**
     * 查询国际化
     * 根据当前用户所在区域进行查询
     */
    public Response getGlobalLanguageByArea(I18nInfo i18nInfo){
        I18nInfo globalInfo = iGlobalDAL.getGlobalLanguageByArea(i18nInfo);
        if(globalInfo!=null){
            return new Response(200,"查询成功",globalInfo);
        }else{
            return new Response(203,"未查询到语言文件","zh-CN");
        }
    }

    /**
     * 查询国际化列表用于设置
     */
    public Response getGlobaLanguageList(){
        return new Response(200,"查询国际化",iGlobalDAL.getGlobaLanguageList());
    }
}
